#curl https://gitee.com/ewf-9/BiJi/raw/master/qemu_win7.sh -o win7.sh && bash win7.sh
#!/data/data/com.termux/files/usr/bin/sh

pkg_install(){
chmod 777 win7.sh
echo "[*]开始安装"
cd ~
pkg update -y && pkg install x11-repo unstable-repo -y && pkg install qemu-utils qemu-system-x86_64-headless  qemu-system-i386-headless -y &&  termux-setup-storage
}
win7_run(){
killall -9 pulseaudio 2>/dev/null
pulseaudio --start &
unset LD_PRELOAD
proot --kill-on-exit -S bullseye-qemu --link2symlink -b /sdcard:/root/sdcard -b /sdcard -b bullseye-qemu/proc/version:/proc/version -b bullseye-qemu/root:/dev/shm -w /root /usr/bin/env -i HOME=/root TERM=xterm-256color USER=root PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games LANG=C.UTF-8 /bin/bash --login
}
xz(){
echo -e "1.手动复制链接下载: https://91io.cn/s/y8MXGCD/win7.tar.gz\n下载好把包放到/data/data/com.termux/files/home/目录下"
echo -e "2.回车自动下载"
stty erase '^H' && read -p "按任意键继续" num
case "$num" in 
*)
esac
}
zh(){
cd
#test_num=`ls -lh win7.tar.gz |awk '{print $5}' |sed 's/G//;s/\.//g'`
#small_num=16
#big_num=18
if [ -e bullseye-qemu/root/ ] && [ -r bullseye-qemu/root/NOTE ];then
pkg_install 
win7_run
elif [ -r win7.tar.gz ];then
pkg_install 
tar zxvf win7.tar.gz
win7_run
#elif [ $test_num -gt $small_num -a $test_num -lt $big_num ] || rm win7P.tar.gz;then
else
pkg_install 
#wget http://od.ixcmstudio.cn/repository/main/windows/win7P.tar.gz
#tar zxvf win7P.tar.gz
wget https://91io.cn/s/y8MXGCD/win7.tar.gz
tar zxvf win7.tar.gz
win7_run
fi
}
zq(){
    cd
    if [[ `cat .bashrc |grep pulseaudio` ]];then
    echo "zq"
    else
    echo -e '\necho "1.启动win7\任意键退出"\necho && stty erase '^H' && echo "1/2：" && read -p "" num\ncase "$num" in \n1)\nif [ -e bullseye-qemu/ ];then \nkillall -9 pulseaudio 2>/dev/null \npulseaudio --start & \nunset LD_PRELOAD \nnohup `proot --kill-on-exit -S bullseye-qemu --link2symlink -b /sdcard:/root/sdcard -b /sdcard -b bullseye-qemu/proc/version:/proc/version -b bullseye-qemu/root:/dev/shm -w /root /usr/bin/env -i HOME=/root TERM=xterm-256color USER=root PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games LANG=C.UTF-8 /bin/bash --login` & \nfi\n;;\n*)\nesac\n' >> .bashrc
    fi

}
zq
xz 
zh
echo "启动完成下载vnc软件: https://91io.cn/s/1yJkVhp/bVNC_Secure_VNC_Viewer_7ba2c35e.apk"
echo "127.0.0.1:0"

